<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <title>注册</title>
    <script src="/Uploads/jquery-1.11.3.min.js"></script>
	<script src="/Uploads/layer/layer.js" type="text/javascript"></script>
    <style>
		body{
			background:#262626;
			color:#c6c6c6;
		}
      .logo-box {
        text-align: center;
        /*border: 1px solid red;*/
        padding: 37px 0 10px;
      }
      img {
        width: 60px;
      }
      h3 {
        font-size: 17px;
        font-weight: bold;
      }

      ul,li{
        list-style: none;
        padding: 0;
      }
      ul{
        /*border: 1px solid blue;*/
        padding: 10px;
      }
      li{
        height: 40px;
        margin: 10px 0;
		border-radius:5px;
		overflow:hidden;
      }
      input{
        width: 100%;
        height: 100%;
        border: none;
        padding: 0 10px;
        outline: none;
        box-sizing: border-box;
		background:#3e3e3e;
		color:#fff;
      }
      button {
        border: none;
        outline: none;
        background: linear-gradient(90deg,#f4bf86,#a76a23);
        color: #131313;
      }
      .register-btn{
        width: 100%;
        height: 40px;
        border-radius: 5px;
		font-size:16px;
      }
      .register-btn:active{
        opacity: .8;
      }
      .sms-code-li{
        position: relative;
      }
      .sms-code-li input{
        padding-right: 90px;
      }
      .sms-code-li button{
        position: absolute;
        right: 0;
        top: 50%;
        height: 100%;
        line-height: 30px;
        transform: translateY(-50%);
        min-width: 80px;
      }
      .sms-code-li button.disabled{
        opacity: .5;
      }

    </style>
    <script>

      window.onload=function () {
	  <!-- var phonevalue = $("#tuijian").val() -->
        <!-- var dh=phonevalue.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'); -->
		<!-- $('#tuijian').val(dh); -->
		
        var smsBtn=document.getElementById("smsBtn");
        smsBtn.onclick=function () {
        	let smsCount=60,
            timeId=null,
            that=this;
        	var phone = $('#phone').val();
          	 $.post("/Home/Reg/sendPhone",{'phone':phone,'type':1},function(d){
          			 if(d['status']==1){
          				 layer.msg('发送成功')
	                    that.disabled=true;
	                    that.setAttribute('class','disabled');
	                    timeId=setInterval(()=>{

	                      if(smsCount > 0){
	                        smsCount--;
	                        if(smsCount < 10){
	                         // console.log(smsCount);
	                          if(smsCount === 0) {
	                            // console.log('完毕');
	                            that.disabled=false;
	                            that.removeAttribute('class','disabled');
	                            smsCount=60;
	                            that.innerText = "获取验证码";
	                            clearInterval(timeId);
	                            return;
	                          }
	                          smsCount= '0' + smsCount;
	                        }
	                        that.innerText = smsCount;
	                      }
	
	                    },1000);
          			}else{
                    	layer.msg(d['info']);return;
          			} 
          		});  
        }
      }
    </script>
    <script>
    function register(){
    	var phone=$('#phone').val();
    	var phone_code=$('#code').val();
    	var password=$('#password').val();
    	var repassword=$('#repassword').val();
    	var pwdtrade=$('#pwdtrade').val();
    	var repwdtrade=$('#repwdtrade').val();
    	var referee=$('#referee').val();
    	var url="{:U('Home/Reg/regh5')}";
    	$.post(url,{'phone':phone,'phone_code':phone_code,'password':password,'repassword':repassword,'pwdtrade':pwdtrade,'repwdtrade':repwdtrade,'referee':referee},function(data){
    		layer.msg(data['info']);
    		if(data['status'] == '1'){
				setTimeout("JumpUrl()",1500);
			}

    	});
    }
		function JumpUrl(){
			location.href="{:U('Reg/code')}";
		}
		
	</script> 
</head>
<body>

  <div class="logo-box">
    <img src='/Uploads/vic.png'>
	<h3>V Wallet</h3>

  </div>
  <ul>
    <li>
      <input type="tel" id='phone' placeholder="手机号">
    </li>
    <li class="sms-code-li">
      <input type="text" id='code' placeholder="手机验证码">
      <button id="smsBtn">获取验证码</button>
    </li>
    <li>
      <input type="password" id='password'  placeholder="登录密码">
    </li>
    <li>
      <input type="password" id='repassword'  placeholder="确认登录密码">
    </li>
    <li>
      <input type="password" id='pwdtrade'  placeholder="交易密码">
    </li>
    <li>
      <input type="password" id='repwdtrade'  placeholder="确认交易密码">
    </li>
    <li>
      <input type="text" readonly value="{$Think.get.referee}" id='tuijian' placeholder="推荐人(必填)">
	  <input  id='referee'  value="{$Think.get.referee}" type='hidden'>
    </li>
  </ul>
  <div style="padding:0 10px;">
    <button class="register-btn" onclick="register()">注册</button>
  </div>

</body>
</html>

